import request from '@/utils/request'

// 获取文件列表
export function listFileList(params) {
  return request({
    url: '/netdisk/file/list',
    method: 'get',
    params: params
  })
}
// 获取文件列表
export function pageFileList(params) {
  return request({
    url: '/netdisk/file/page',
    method: 'get',
    params: params
  })
}
// 上传文件
export function uploadFile(data) {
  return request({
    url: '/netdisk/file/uploadFile',
    headers: { 'Content-Type': 'multipart/form-data' },
    method: 'post',
    data: data
  })
}
// 创建文件夹
export function createFolder(data) {
  return request({
    url: '/netdisk/file/createFolder',
    headers: { 'Content-Type': 'multipart/form-data' },
    method: 'post',
    data: data
  })
}
// 重命名文件
export function renameFile(data) {
  return request({
    url: '/netdisk/file/renameFile',
    headers: { 'Content-Type': 'multipart/form-data' },
    method: 'put',
    data: data
  })
}
// 删除文件
export function deleteFile(fileId) {
  return request({
    url: '/netdisk/file/delete/' + fileId,
    method: 'delete',
  })
}
// 预览文件
export function previewFile(fileId) {
  return request({
    url: '/netdisk/file/preview/' + fileId,
    method: 'get',
  })
}
// 下载文件
export function downloadFile(fileId) {
  return request({
    url: '/netdisk/file/download/' + fileId,
    method: 'get',
  })
}
// 移动文件
export function moveFile(data) {
  return request({
    url: '/netdisk/file/moveFile',
    method: 'put',
    data: data
  })
}
// 暂停上传
export function pauseUpload(params) {
  return request({
    url: '/netdisk/file/pauseUpload',
    method: 'get',
    params: params
  })
}
// 继续上传 
export function resumeUpload(params) {
  return request({
    url: '/netdisk/file/resumeUpload',
    method: 'get',
    params: params
  })
}
// 取消上传 
export function cancelUpload(params) {
  return request({
    url: '/netdisk/file/cancelUpload',
    method: 'get',
    params: params
  })
}